﻿using Xejen.Hosting;
using Xejen.Hosting.Extensions;
using Xejen.Logger;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;

namespace Xejen.Languages.Abstract
{
    /// <inheritdoc cref="ILanguageBuilder"/>
    internal sealed class LanguageBuilder : ILanguageBuilder
    {
        private readonly IAppHost _host;
        private readonly ILogger _logger;
        private readonly IConfiguration _configuration;
        private readonly ILoggerManager _loggerManager;

        /// <inheritdoc cref="IAppHost"/>
        public IAppHost Host => _host;
        /// <inheritdoc cref="IConfiguration"/>
        public IConfiguration Configuration => _configuration;
        /// <inheritdoc cref="ILogger"/>
        public ILoggerManager LoggerManager => _loggerManager;

        /// <inheritdoc cref="LanguageBuilder"/>
        /// <param name="host"><inheritdoc cref="IAppHost" path="/summary"/></param>
        public LanguageBuilder(IAppHost host)
        {
            Check.NotNull(host, nameof(host));

            _host = host;
            _configuration = host.Configuration;
            _loggerManager = host.LoggerManager;
            _logger = _loggerManager.CreateLogger<LanguageBuilder>();
        }
    }
}
